/******************************************************************************
 * @file       deviceselfchecking.cpp
 * @brief      设备自检页面
 *****************************************************************************/
#include "deviceselfchecking.h"

#include <QQmlContext>

/**
 * @brief 构造函数
 */
DeviceSelfChecking::DeviceSelfChecking(QWidget *parent)
    : QQuickWidget(parent)
{
    this->setFixedSize(462, 291);
    this->setWindowTitle("设备自检");
    this->setWindowFlags(Qt::Window | Qt::WindowCloseButtonHint);

    // 设置属性

    // 暴露自身对象
    this->getContext()->setContextProperty("deviceSelfChecking", this);

    // 加载qml
    this->setResizeMode(QQuickWidget::SizeRootObjectToView);
    this->setSource(QUrl("qrc:/deviceselfchecking.qml"));
}

/**
 * @brief 析构函数
 */
DeviceSelfChecking::~DeviceSelfChecking()
{}

/**
 * @brief getContext 获取qmlcontext
 * @return qmlContext
 */
QQmlContext* DeviceSelfChecking::getContext() const
{
    return this->rootContext();
}

/**
 * @brief getRootObject 获取rootObject
 * @return rootObject
 */
QObject* DeviceSelfChecking::getRootObject() const
{
    qDebug() << "this->rootObject()" << this->rootObject();
    return (QObject*)this->rootObject();
}
